<p>
 Step 1: Initialize your algorithm and filter the contract. Here we choose the time to expiration to be between 30 to 60 days.
</p>
<div class="section-example-container">

<pre class="python">def Initialize(self):
	self.SetStartDate(2017, 4, 01)
	self.SetEndDate(2017, 6, 30)
	self.SetCash(100000)
	equity = self.AddEquity("GOOG", Resolution.Minute)
	option = self.AddOption("GOOG", Resolution.Minute)
	self.symbol = option.Symbol
	# set our strike/expiry filter for this option chain
	option.SetFilter(-5, 5, timedelta(30), timedelta(60))
	# use the underlying equity GOOG as the benchmark
	self.SetBenchmark(equity.Symbol)
</pre>
</div>
<p>
 Step 2: Sort the option chain by expiration and choose the furthest date to filter the call contract. Then sort those call contracts by their strike price and choose the call contracts with the highest strike price to trade.
</p>
<div class="section-example-container">

<pre class="python">for i in optionchain:
	if i.Key != self.symbol: continue
	chain = i.Value
	# sort the optionchain by expiration date and choose the furthest date
	expiry = sorted(chain,key = lambda x: x.Expiry, reverse=True)[0].Expiry
	# filter the call options from the contracts expires on that date
	call = [i for i in chain if i.Expiry == expiry and i.Right == 0]
	# sort the contracts according to their strike prices
	call_contracts = sorted(call,key = lambda x: x.Strike)
	if len(call_contracts) == 0: continue
	self.call = call_contracts[0]
</pre>
</div>
<p>
 Step 3: According to the call option contract, choose the put option with the same strike price and the same expiration date. Then buy the call option and the put option at the same time and wait until expiration.
</p>
<div class="section-example-container">

<pre class="python"> for i in chain:
	if i.Expiry == expiry and i.Right == 1 and i.Strike ==call_contracts[0].Strike:
	    self.put = i
self.Buy(self.call.Symbol ,1)
self.Buy(self.put.Symbol ,1)
</pre>
</div>
